import Vue from 'vue';
import ElementUI from 'element-ui';

import App from './App.vue';
import router from './router';
import store from './store';
import Http from './http';
import Utils from './utils';
import Drective from './directives';
import * as Filters from './filters';
import Permission from './utils/helper/permission';

import '@/assets/css/index.less'; // global less

Vue.config.productionTip = false;

Vue.use(ElementUI);
Vue.use(Drective);
Vue.use(Permission);

// register global utility filters.
Object.keys(Filters).forEach(key => {
  Vue.filter(key, Filters[key]);
});

Object.defineProperty(Vue.prototype, '$http', {
  get: () => Http
});
Object.defineProperty(Vue.prototype, '$utils', {
  get: () => Utils
});

if (process.env.VUE_APP_CURRENTMODE === 'production') {
  // eslint-disable-next-line no-console
  console.log = () => {};
}

// 引入mockjs
require('./mock/index.js');

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app');
